<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ajax Get 测试实例</title>
    <script src="https://cdn.staticfile.org/vue/3.2.31/vue.global.min.js"></script>
    <script src="https://cdn.staticfile.org/axios/1.5.0/axios.min.js"></script>
</head>

<body>
    <div id="app">
        {{ data.data }}
        {{ data.total }}
    </div>
    <script>
        const app = {
            data() {
                return {
                    data: 'Ajax get 方法测试!'
                }
            },
            mounted() {
                axios
                    .get('http://localhost:8081/user/page')
                    .then(response => (this.data = response.data))
                    .catch(function (error) {  // 请求失败处理
                        console.log(error);
                });
            }
        }
        Vue.createApp(app).mount('#app')
    </script>
</body>

</html>